<template>
    <div class="doctor-card">
        <!-- round是否显示圆形 默认是false -->
        <van-image round :src="item.avatar" />
        <p class="name">{{ item.name }}</p>
        <p class="van-ellipsis">{{ item.hospitalName }}</p>
        <p>{{ item.positionalTitles }}</p>
        <van-button round size="small" type="primary" @click="follow(item)" :loading="loading">
            {{ item.likeFlag === 1 ? '已关注' : '+ 关注' }}
        </van-button>
    </div>
</template>

<script setup lang="ts">
import type { Doctor } from '@/types/consult'
import { useFollow } from '@/composable/index'


defineProps<{ item: Doctor }>()

// 关注部分
const { loading, follow } = useFollow()

</script>

<style scoped lang="scss">
.doctor-card {
    width: 135px;
    height: 190px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0px 0px 11px 0px rgba(229, 229, 229, 0.2);
    text-align: center;
    padding: 15px;
    margin-left: 15px;
    display: inline-block;
    box-sizing: border-box;

    >.van-image {
        width: 58px;
        height: 58px;
        // vertical-align 用来指定行内元素（inline）或表格单元格（table-cell）元素的垂直对齐方式。
        vertical-align: top;
        border-radius: 50%;
        margin: 0 auto 8px;
    }

    >p {
        margin-bottom: 0;
        font-size: 11px;
        color: var(--cp-tip);

        &.name {
            font-size: 13px;
            color: var(--cp-text1);
            margin-bottom: 5px;
        }
    }

    >.van-button {
        padding: 0 12px;
        height: 28px;
        margin-top: 8px;
        width: 72px;
    }
}
</style>